{% for endpoint, details in api_endpoints.items() %}
@app.route('{{ endpoint }}', methods=['{{ details.methods|join(', ') }}'])
def {{ details.function_name }}():
    {{ details.code|safe }}
{% endfor %}